//  雷爽爽 start

window.onload = function() {
  //   外面大tab栏切换
var h4 = document.querySelectorAll('.box_tit');
var tab_bd1 = document.querySelectorAll('.tab_bd1');
var odr_btn = document.querySelector('.odr_btn');
// 鼠标移入事件
for(var j = 0; j < h4.length; j++) {
    // 添加自定义属性
    h4[j].setAttribute('data-index',j);
    h4[j].onmouseover = function() {
      var index = this.getAttribute('data-index');
       for(var j = 0; j < h4.length; j++) {
        tab_bd1[j].style.display = 'none';
        h4[j].classList.remove('red');
       }    
       if(index == 1) {
        odr_btn.style.display = 'block';
       }else {
        odr_btn.style.display = 'none';
    }
       tab_bd1[index].style.display = 'block';
       this.classList.add('red');
    }
    };



//  热门活动tab模块切换
//  获取每个a
var as = document.querySelector('.nav_hd').querySelectorAll('a');
var is = document.querySelector('.nav_line');
var swiper = document.querySelectorAll('.nav_sweiper');
// // 鼠标移入事件
for(var i = 0; i < as.length; i++) {
    // 添加自定义属性
    as[i].setAttribute('data-indexs',i);
    as[i].onmouseover = function() {
        getDonte(is, this.offsetLeft);
        var index = this.getAttribute('data-indexs');
       for(var i = 0; i < as.length; i++) {
        swiper[i].style.display = 'none';
       }
       swiper[index].style.display = 'block';
    }
}



// 梦幻热点区域的tab栏切换
var iss = document.querySelector('.nav_lines');
var swi_itms = document.querySelectorAll('.swi_itms');
var aa = document.querySelector('.nav_hds').querySelectorAll('a');
for(var s = 0; s < aa.length; s++) {
    // 添加自定义属性
    aa[s].setAttribute('index',s);
    aa[s].onmouseover = function() {
        var index_dex = this.getAttribute('index');
        getDonte(iss, this.offsetLeft);
        // var indexss = this.getAttribute('data-indexss');
       for(var s = 0; s < aa.length; s++) {
        swi_itms[s].style.display = 'none';
       }
       swi_itms[index_dex].style.display = 'block';
    }
}


// 最右侧轮播图
var ps = document.querySelectorAll('.ban_qiehuan a');
var ban_qiehuan = document.querySelector('.ban_qiehuan');
var bannner = document.querySelector('.bannner_lss');
var lis = document.querySelectorAll('.bannner_lss li');
var temp = document.querySelector('.cal_temp_lss');
// 鼠标移入事件
for(var c = 0; c < ps.length; c++) {
       //  给每个a设置自定义属性名
    ps[c].setAttribute('data-banr',c);
    ps[c].onmouseover = function() {
        // clearInterval(times);
          // 获取自定义属性
    var index5 = this.getAttribute('data-banr');
    // console.log(index5);
    bannner.style.left = -temp.offsetWidth * index5 + 'px';
    for(var c = 0; c < ps.length; c++){
        ps[c].className = '';  
    } 
    this.className = 'ons';
 }
}

//  自动轮播
var num =0;
var times = setInterval(function() {
  if(num==4){
    num =0;
  }
    ps[num].onmouseover();
    num++ ;
        // console.log();
},2000);
// 鼠标移入停止定时器
ban_qiehuan.onmouseover = function() {
    clearInterval(times);
}
// 鼠标移出
ban_qiehuan.onmouseout = function() {
    times = setInterval(function() {
        if(num==4){
          num =0;
        }
          ps[num].onmouseover();
          num++ ;
              // console.log();
      },2000);
}
// 雷爽爽 end
}